home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1044 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.4 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: Rich Paul <rpaul@trcinc.com>
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Template Syntax
  5. Date: 12 Apr 1996 01:16:29 GMT
  6. Organization: ?
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4kkatd$e59@engnews1.Eng.Sun.COM>
  9. NNTP-Posting-Host: taumet.eng.sun.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset="us-ascii"
  12. Content-Transfer-Encoding: 7bit
  13. X-Nntp-Posting-Host: bajor-le1.trcinc.com
  14. X-Lines: 54
  15. Content-Length: 1598
  16. Originator: clamage@taumet
  17.  
  18. Scott Meyers wrote:
  19. > I was under the impression that the use of a template name inside the
  20. > definition of a class template was implicitly considered to be qualified
  21. > by the template parameter(s).  For example, I thought that in
  22. >   template <class T>
  23. >   class Array {
  24. >   public:
  25. >     Array operator=(const Array& rhs);
  26. >     ...
  27. >   };
  28.  
  29. The following is a quote from the January '96 working paper.  However, I'm told that
  30. that document is already obsolete ( though I gather it's mostly in the library ...
  31.  
  32. [ moderator's note: the working paper is updated every four months. The January
  33. version is the latest that has been published, but some changes were made at
  34. the March meeting. -sdc ]
  35.  
  36. --- BEGIN WP QUOTE ---
  37.  
  38. 1 Within the scope of a class template or a specialization of a template
  39.   the  name  of  the  template is equivalent to the name of the template
  40.   followed by the template-parameters enclosed  in  <>.   [Example:  the
  41.   constructor  for Set can be referred to as Set() or Set<T>().  ] Other
  42.   specializations (_temp.spec_) of the  class  can  be  referred  to  by
  43.   explicitly  qualifying  the  template  name with appropriate template-
  44.   arguments.  [Example:
  45.           template<class T> class X {
  46.                   X* p;           // meaning X<T>
  47.                   X<T>* p2;
  48.                   X<int>* p3;
  49.           };
  50.           template<class T> class Y;
  51.  
  52.           template<> class Y<int> {
  53.                   Y* p;           // meaning Y<int>
  54.           };
  55.    --end example] [Note: see _temp.param_ for  the  scope  of  template-
  56.   parameters.  ]
  57.  
  58. --- END WP QUOTE ---
  59.  
  60.  
  61. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  62. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  63. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  64. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  65. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  66.